home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 1 / LSD Compendium Deluxe 1.iso / a / disk / misc / string11.lha / malloc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-16  |  384 b   |  32 lines

  1. /*
  2.  *  FILE
  3.  *    malloc.c
  4.  *
  5.  *  DESCRIPTION
  6.  *    allocate memory
  7.  *
  8.  *  SEE ALSO
  9.  *    free()
  10.  *
  11.  *  TODO
  12.  *    Används errno-variabeln.
  13.  */
  14.  
  15. #include <exec/types.h>
  16. #include <exec/memory.h>
  17.  
  18. #include <proto/exec.h>
  19.  
  20. void *
  21. malloc(unsigned int size)
  22. {
  23.     register long * ptr;
  24.  
  25.     if (ptr = (long *)AllocMem(size+4, MEMF_PUBLIC)) {
  26.     ptr[0] = size+4;
  27.  
  28.     ptr++;
  29.     }
  30.     return((void *)ptr);
  31. }
  32.